package view;

import javax.swing.Box;
import controller.FirewallSession;
import server.RulesTableType;

/**
 * Class is responsible for advanced user rules frame.
 * Frame contains all elements that are defined in inherited class.
 */
public class RulesStandartFrame extends AbstractRulesFrame
{
	/**
	 * Serial version ID - for serialization
	 */
	private static final long serialVersionUID = -9054477174649758834L;
	
	/**
	 * C'tor - Frame with specified controller is created.
	 * @param ui	- the controller for the system actions
	 */
	private RulesStandartFrame(FirewallSession ui)
	{
		super(ui);
		setLocationRelativeTo(null);
	}

	/**
	 * Returns current frame if exists, else creates and registers it.
	 * @return rules frame
	 */
	public static AbstractRulesFrame getInstance(FirewallSession ui)
	{
		if(currentRulesFrame == null)
		{
			currentRulesFrame = new RulesStandartFrame(ui);
		    StatusBar.register(currentRulesFrame);
		}
		
		return currentRulesFrame;
	}
	
	/**
	 * No special buttons for standart user.
	 * @return group of the standart special user buttons.
	 */
	protected Box getDownRulesButtons()
	{
		return null;
	}
	
	/**
	 * @param table in/out type
	 * @return table of rules
	 */
	protected AbstractRulesTable getTable(RulesTableType type)
	{
		return new RulesStandartTable(type, UI);
	}

	/**
	 * @return the frame title
	 */
	public String getTitle()
	{
		return "Standart Rules Window";
	}
}
